<%= form_for(Settings::General.new,
             url: admin_settings_general_settings_path,
             html: { data: { action: "submit->config#updateConfigurationSettings" } }) do |f| %>
  <details class="crayons-card">
    <summary class="crayons-subtitle-2 p-6">Social Media</summary>
    <div class="p-6 pt-0">
      <fieldset class="grid gap-4">
        <div class="crayons-field">
          <%= admin_config_label :twitter_hashtag %>
          <%= admin_config_description Constants::Settings::General.details[:twitter_hashtag][:description] %>
          <%= f.text_field :twitter_hashtag,
                           class: "crayons-textfield",
                           value: Settings::General.twitter_hashtag.to_s,
                           placeholder: Constants::Settings::General.details[:twitter_hashtag][:placeholder] %>
        </div>
        <%= f.fields_for :social_media_handles do |social_media_field| %>
          <% Settings::General.social_media_services.each do |platform, username| %>
            <div class="crayons-field">
              <%= admin_config_label platform %>
              <p class="crayons-field__description">
              <%= platform == "mastodon" ? "Mastodon complete URL including \"https://\"" : "#{platform.capitalize} username" %>
              </p>
              <%= social_media_field.text_field platform,
                                                class: "crayons-textfield",
                                                value: Settings::General.social_media_handles[platform],
                                                placeholder: platform == "mastodon" ? "https://fosstodon.org/@thepracticaldev" : "" %>
            </div>
          <% end %>
        <% end %>
      </fieldset>
      <%= render "update_setting_button", f: f %>
    </div>
  </details>
<% end %>
